/**
 * Alibaba.com.cn Inc.
 * Copyright (c) 2004-2021 All Rights Reserved.
 */
package com.smart.utils;

import cn.hutool.core.date.DateUtil;

import java.util.Date;

/**
 * @author zhanghong
 * @version WeekUtil.java, v 0.1 2024/1/9 18:38 下午 WeekUtil Exp $$
 */
public class WeekUtil {

    /**
     * 获取当前是今年的第周
     * @return
     */
    public static int getWeekNum() {
        Date date = new Date();
        int weekNum = DateUtil.weekOfYear(date);
        //if (weekNum - 1 > 0) {
        //    // 涉及到周的计算，见weekOfYear方法注释，这里和前端保持统一，前端空间周开始是周一，hutool默认是周日，所以需要减一，保持前后端一直
        //    weekNum = weekNum - 1;
        //}
        return weekNum;
    }
}
